Skip to content

Conversation

@Dannyj1
Copy link
Owner

@Dannyj1 Dannyj1 commented May 21, 2025

Adds support for the OCR API: https://docs.mistral.ai/api/#tag/ocr

Closes #8


Important

Adds OCR functionality to the Mistral Java client, including new models and methods for handling OCR requests synchronously and asynchronously.

  • Behavior:
    • Adds OCR functionality to MistralClient with performOcr() and performOcrAsync() methods for synchronous and asynchronous OCR operations.
    • Updates MistralService with performOcr() and performOcrAsync() methods to handle OCR requests.
  • Models:
    • Introduces OCRRequest, OCRResponse, OCRPageObject, OCRImageObject, OCRPageDimensions, and OCRUsageInfo classes in nl.dannyj.mistral.models.ocr for handling OCR data.
    • Adds DocumentURLChunk builder pattern in nl.dannyj.mistral.models.completion.content.
  • Documentation:
    • Updates README.md to include OCR usage example.
    • Updates CHANGELOG.md to reflect the addition of OCR functionality.
  • Misc:
    • Bumps version to 2.1.0 in build.gradle and README.md.

This description was created by Ellipsis for f27b700. You can customize this summary. It will automatically update as commits are pushed.

@Dannyj1 Dannyj1 self-assigned this May 21, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Changes requested ❌

Reviewed everything up to f27b700 in 1 minute and 49 seconds. Click for details.
  • Reviewed 677 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. README.md:441
  • Draft comment:
    The OCR example calls 'client.createOcrCompletion(request)', but the new API method in MistralClient is named 'performOcr'. Please update the example accordingly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% I need to be very careful here. The comment claims there's a mismatch between the example code and the actual API method name, but I don't have access to the actual Java client code to verify this. Without being able to see the MistralClient class implementation, I cannot be 100% certain which method name is correct. The comment could be right or wrong. I don't have access to the actual Java client implementation to verify which method name is correct. Making this change without that verification could introduce errors. Given the uncertainty and lack of evidence about the correct method name, we should err on the side of caution and not make this change. Without being able to verify the correct method name in the actual Java client implementation, we should not keep this comment as it could potentially introduce errors.
2. src/main/java/nl/dannyj/mistral/services/MistralService.java:72
  • Draft comment:
    Consider caching the ValidatorFactory instead of closing it immediately. While Hibernate Validator may allow usage of a Validator after closing the factory, caching it could improve performance and avoid potential issues with other implementations.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_K63Auz5Y33ztamDo

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@sonarqubecloud
Copy link

@Dannyj1 Dannyj1 changed the title feat: Add OCR functionality Add OCR functionality May 21, 2025
@Dannyj1 Dannyj1 merged commit 5392843 into master May 21, 2025
5 checks passed
@Dannyj1 Dannyj1 deleted the mistral-ocr branch May 21, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mistral OCR

2 participants